﻿using System.ComponentModel;
using RaytracerLib.RenderableObjects;
using RaytracerLib.Materials;
using RaytracerLib.UVMappers;

namespace Raytracer.PropertyGridDecorators
{
    public class CylinderObjectProperties : RenderableObjectProperties
    {
        private CylinderObject m_cylinder;

        public CylinderObjectProperties(CylinderObject a_cylinder) :
            base(a_cylinder)
        {
            m_cylinder = a_cylinder;
        }

        [Category(Categories.PROPERTIES)]
        [TypeConverter(typeof(DoubleConverter))]
        public double Radius
        {
            get
            {
                return m_cylinder.Radius;
            }
            set
            {
                m_cylinder.Radius = value;
            }
        }

        [Category(Categories.PROPERTIES)]
        [TypeConverter(typeof(DoubleConverter))]
        public double Height
        {
            get
            {
                return m_cylinder.Height;
            }
            set
            {
                m_cylinder.Height = value;
            }
        }

        [TypeConverter(typeof(MaterialConverter))]
        [Category(Categories.PROPERTIES)]
        [DisplayName("Top material")]
        public Material TopMaterial
        {
            get
            {
                return m_cylinder.TopMaterial;
            }
            set
            {
                if (value == null)
                    return;

                m_cylinder.TopMaterial = value;
            }
        }

        [TypeConverter(typeof(MaterialConverter))]
        [Category(Categories.PROPERTIES)]
        [DisplayName("Bottom material")]
        public Material BottomMaterial
        {
            get
            {
                return m_cylinder.BottomMaterial;
            }
            set
            {
                if (value == null)
                    return;

                m_cylinder.BottomMaterial = value;
            }
        }
    }
}